git clone  https://git.oschina.net/wr4ng1er/rsync-3.1.1.git

cd rsync-3.1.1/

./configure --prefix=/opt/rsyncd && make && make install

echo 'export PATH=$PATH:/opt/rsyncd/bin' >> /etc/profile 
source /etc/profile 



mkdir /opt/rsyncd/etc/ -p
touch /opt/rsyncd/etc/rsyncd.conf  
touch /opt/rsyncd/etc/rsyncd.secrets  
touch /opt/rsyncd/etc/rsyncd.motd
chmod 600 /opt/rsyncd/etc/rsyncd.secrets  


cat >/opt/rsyncd/etc/rsyncd.motd <<EOF
+++++++++++++++++++++++++++
+ linuxsir.org  rsync  2002-2007 +
+++++++++++++++++++++++++++
EOF

cat >/opt/rsyncd/etc/rsyncd.secrets <<EOF
linuxsir:edm123+++
beinan:edm123+++
EOF



cat > /opt/rsyncd/etc/rsyncd.conf <<EOF

pid file = /var/run/rsyncd.pid   
port = 873
address = 192.168.1.146     
uid = root   
gid = root  
use chroot = yes  
read only = yes 
hosts allow=192.168.1.0/255.255.255.0 10.0.1.0/255.255.255.0  
hosts deny=*
max connections = 5 
motd file = /etc/rsyncd.motd
log file = /var/log/rsync.log
#transfer logging = yes
log format = %t %a %m %f %b
syslog facility = local3
timeout = 300

[rhel4home]   
path = /home    
list=yes 
ignore errors 
auth users = root
secrets file = /etc/rsyncd.secrets  
comment = This is RHEL 4 data  
exclude = easylife/  samba/   

[www]
path = /opt 
list=no
ignore errors
comment = This is RHEL 4 opt 
auth users = easylife
secrets file = /etc/rsyncd.secrets

EOF

rm -rf /etc/rsyncd.*
ln -s /opt/rsyncd/etc/rsyncd.conf /etc/rsyncd.conf 
ln -s /opt/rsyncd/etc/rsyncd.secrets  /etc/rsyncd.secrets 
ln -s /opt/rsyncd/etc/rsyncd.motd  /etc/rsyncd.motd



rsync --daemon  --config=/etc/rsyncd.conf &

